OPC Studio User's Guide and Reference
Synchronize<TResult>(Func<TResult>) Method



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Widgets Namespace > NotifyingWidget Class > Synchronize Method : Synchronize<TResult>(Func<TResult>) Method
Type of the function result.
Function to be invoked.

The value of this parameter cannot be null (Nothing in Visual Basic).

Invokes the specified function in a synchronized manner.
Syntax
'Declaration
 
<CanBeNullAttribute()>
Protected Overloads Function Synchronize(Of TResult As Class)( _
   ByVal function As Func(Of TResult) _
) As TResult
'Usage
 
Dim instance As NotifyingWidget
Dim function As Func(Of TResult)
Dim value As TResult
 
value = instance.Synchronize(Of TResult)(function)
[CanBeNull()]
protected TResult Synchronize<TResult>( 
   Func<TResult> function
)
where TResult: class
[CanBeNull()]
protected:
TResult^ Synchronizegeneric<typename TResult>
( 
   Func<TResult^>^ function
) 
where TResult: ref class

Parameters

function
Function to be invoked.

The value of this parameter cannot be null (Nothing in Visual Basic).

Type Parameters

TResult
Type of the function result.

Return Value

Returns the result of invoking the specified function.

This method can return null (Nothing in Visual Basic).

Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also